export const _students = [
  {
    id: 1,
    name: "张无忌",
    avatar: "/vite.svg",
    age: 20,
    gender: "男",
    score: 85,
  },
  {
    id: 2,
    name: "黄蓉",
    avatar: "/vite.svg",
    age: 22,
    gender: "女",
    score: 92,
  },
  {
    id: 3,
    name: "令狐冲",
    avatar: "/vite.svg",
    age: 19,
    gender: "男",
    score: 78,
  },
  {
    id: 4,
    name: "杨过",
    avatar: "/vite.svg",
    age: 21,
    gender: "男",
    score: 88,
  },
  {
    id: 5,
    name: "小龙女",
    avatar: "/vite.svg",
    age: 23,
    gender: "女",
    score: 95,
  },
  {
    id: 6,
    name: "任盈盈",
    avatar: "/vite.svg",
    age: 20,
    gender: "男",
    score: 81,
  },
  {
    id: 7,
    name: "岳灵珊",
    avatar: "/vite.svg",
    age: 18,
    gender: "女",
    score: 73,
  },
  {
    id: 8,
    name: "陆小凤",
    avatar: "/vite.svg",
    age: 24,
    gender: "男",
    score: 90,
  },
  {
    id: 9,
    name: "赵敏",
    avatar: "/vite.svg",
    age: 22,
    gender: "女",
    score: 87,
  },
  {
    id: 10,
    name: "倚天剑",
    avatar: "/vite.svg",
    age: 21,
    gender: "男",
    score: 79,
  },
];

<<<<<<< HEAD
export function getStudents(page: number = 10) {
  let students: any[] = [];

  for (let i = 0; i < page; i++) {
    students = students.concat(_students);
  }

  // 深拷贝之-JSON转译法
  // 优点：简单粗暴快捷
  // 缺点：不支持函数，不支持undefined
=======
export function getStudents(page: number = 10, moreCols = false) {
  let students: any[] = [];
  for (let i = 0; i < page; i++) {
    students = students.concat(_students);
  }
>>>>>>> dev-rollup
  students = JSON.parse(JSON.stringify(students));

  students.forEach((item, i) => {
    item.id = i + 1;
    item.name += parseInt(i / 10 + "");
<<<<<<< HEAD
    item.age = Math.ceil(18 + 62*Math.random())
=======
    item.age = Math.ceil(Math.random() * 100);
    item.score = Math.ceil(Math.random() * 100);

    if (moreCols) {
      item.iq = Math.ceil(Math.random() * 150);
      item.eq = Math.ceil(Math.random() * 150);
      item.money = Math.ceil(Math.random() * 1000000);

      item.height = Math.ceil(100 + Math.random() * 200);
      item.weight = Math.ceil(60 + Math.random() * 100);
      item.tax = Math.ceil(Math.random() * 100000);
    }
>>>>>>> dev-rollup
  });

  return students;
}

export default getStudents(10);
